package treemap;


import treemap.bean.Dog;

import java.util.Map;
import java.util.Set;
import java.util.TreeMap;

//关于中文拼音排序
public class Demo03 {

    public static void main(String[] args) {

        TreeMap<Dog, Integer> map = new TreeMap<>();
        Dog dog1 = new Dog("宝贝", 2);
        Dog dog2 = new Dog("阿黄", 4);
        Dog dog3 = new Dog("查黄", 3);
        Dog dog4 = new Dog("阿白", 7);
        Dog dog5 = new Dog("宝啊", 2);

        map.put(dog1,1);
        map.put(dog2,2);
        map.put(dog3,3);
        map.put(dog4,4);
        map.put(dog5,5);

        Set<Map.Entry<Dog, Integer>> entries = map.entrySet();
        for (Map.Entry<Dog, Integer> entry : entries) {
            System.out.println(entry.getKey()+"--"+entry.getValue());
        }

    }

}
